<script type="text/javascript">
$(function(){
	var pg = App.base.deptIndex.ui
		, pp = pg.params
		, tabs = pg.find('.tabs')
		, infoPl = pg.find('.form')
		, userPl = pg.find('.userPl')
		, projPl = pg.find('.projPl')
		, pathPl = pg.find('.pathPl');

	function init(o){
		setValues(o);
		var items=[{
			code: 'infoPl',title: '基本信息',el: infoPl
		},{
			code: 'userPl',title: '成员管理',
			auth: 'sys.user.list',
			render: function(p,c){
				App.show({
					ctx: 'auth',
					action: 'sysUserIndex',
					params: {deptId: pg.params.key }
				},$.noop,p);
			}
		},{
			code: 'projPl',title: '系统列表',
			auth: 'proj.list',
			render: function(p,c){
				App.show({
					ctx: 'base',
					action: 'projList',
					params: {id:pp.id}
				},function(s){pg.callback(s);},p);
			}
		}];
		var ctx = App.ctx.substring(1),
			ex = App[ctx].deptIndex;
		if (ex && ex.tabs) {
			for (var i=0; i<ex.tabs.length; i++) {
				items.push(ex.tabs[i]);
			}
		}
		items = $.map(items, function(a){
			if (a.auth && !App.logon.power(a.auth)) {
				if (a.el) {
					a.el.hide();
				}
				return null;
			}
			return a;
		});
		tabs.mac('tabs', {
			tabWidth: 80,
			tabHeight: 32,
			items: items
		}).selectFirst();
		
		function adjust(){
			var h = pg.parent().height();
			pg.height(h);
			tabs.height(h - 4);
			tabs.adjust();
			h = tabs.children('.body').height() - 44;
		}
		$(window).resize(adjust);
		adjust();	
	}
	
	function setValues(o){
		infoPl.seek('code').text(o.code);
		infoPl.seek('name').text(o.title);
		infoPl.seek('path').text(o.path);
		infoPl.seek('memo').text(o.memo);
	}
	
	init(pg.params);
});
</script>
<div class="tabs"></div>
<div class="infoPl form">
	<div class="item">
		<span class="label">英文名：</span> <span class="value" name="code"></span>
	</div>
	<div class="item">
		<span class="label">中文名：</span> <span class="value" name="name"></span>
	</div>
	<div class="item">
		<span class="label">备注：</span> <span name="memo"></span>
		<div class="clear"></div>
	</div>
</div>
<div class="projPl">
</div>
<div class="pathPl"></div>